Clean up a few missing prototypes, normalize calls to fatal somewhat.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 25 Oct 2002 14:48:22 +0000 (14:48 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 25 Oct 2002 14:48:22 +0000 (14:48 +0000)
gpsbabel/cetus.c
gpsbabel/defs.h
gpsbabel/geo.c
gpsbabel/gpspilot.c
gpsbabel/magproto.c
gpsbabel/util.c

index 6034475e0694daab00e995801d19048009982223..c6b2fe638e2ad1b13e99a6e659348be9f792cce0 100644 (file)
@@ -98,11 +98,11 @@ data_read(void)
        struct pdb_record *pdb_rec;
 
        if (NULL == (pdb = pdb_Read(fileno(file_in)))) {
-               fatal(MYNAME ": pdb_Read failed");
+               fatal(MYNAME ": pdb_Read failed\n");
        }
 
        if ((pdb->creator != MYCREATOR) || (pdb->type != MYTYPE)) {
-               fatal(MYNAME ": Not a Cetus file.");
+               fatal(MYNAME ": Not a Cetus file.\n");
        }
 
        for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) {
@@ -188,11 +188,11 @@ cetus_writewpt(waypoint *wpt)
        opdb_rec = new_Record (0, 0, ct++, sizeof(*rec), (const ubyte *)rec);
 
        if (opdb_rec == NULL) {
-               fatal(MYNAME ": libpdb couldn't create record");
+               fatal(MYNAME ": libpdb couldn't create record\n");
        }
 
        if (pdb_AppendRecord(opdb, opdb_rec)) {
-               fatal(MYNAME ": libpdb couldn't append record");
+               fatal(MYNAME ": libpdb couldn't append record\n");
        }
 }
 
index f626ea393913ee9661ddfa35f1d19f8df48ff768..4405c384df308ca98f4c10810616c0eb17d52708 100644 (file)
@@ -149,17 +149,24 @@ typedef void (*ff_deinit) (void);
 typedef void (*ff_read) (void);
 typedef void (*ff_write) (void);
 
+void fprintdms(FILE *, const coord *, int);
+
 typedef void (*waypt_cb) (const waypoint *);
 void waypt_add (waypoint *);
 void waypt_del (waypoint *);
-void route_add (waypoint *);
 void waypt_disp_all(waypt_cb);
 unsigned int waypt_count(void);
-void fprintdms(FILE *, const coord *, int);
+
+route_head *route_head_alloc(void);
+void route_add (waypoint *);
+void route_add_wpt(route_head *rte, waypoint *wpt);
+void route_add_head(route_head *rte);
+
 char *mkshort (const char *);
 void setshort_length(int n);
 void setshort_badchars(const char *);
 void setshort_mustupper(int n);
+void setshort_whitespace_ok(int n);
 
 typedef struct ff_vecs {
        ff_init rd_init;
@@ -173,7 +180,11 @@ typedef struct ff_vecs {
 void waypt_init(void);
 void route_init(void);
 void waypt_disp(const waypoint *);
-void fatal(const char *, ...);
+void fatal(const char *, ...)
+#if __GNUC__
+       __attribute__ ((__format__ (__printf__, 1, 2)));
+#endif
+       ;
 ff_vecs_t *find_vec(char *);
 void disp_vecs(void);
 void printposn(const coord *c, int is_lat);
index 92b039faeadfa7d76d5d00456310e4bafb680667..fe2467b8c7afe9d1e876c6754fd92d66cb17c198 100644 (file)
@@ -145,12 +145,12 @@ geo_rd_init(const char *fname)
 {
        fd = fopen(fname, "r");
        if (fd == NULL) {
-               fatal(MYNAME ":Can not open %s for reading\n");
+               fatal(MYNAME ":Cannot open %s for reading\n", fname);
        }
 
        psr = XML_ParserCreate(NULL);
        if (!psr) {
-               fatal(MYNAME ":Can not create XML parser\n");
+               fatal(MYNAME ":Cannot create XML parser\n");
        }
 
        XML_SetElementHandler(psr, geo_start, geo_end);
@@ -169,7 +169,7 @@ geo_wr_init(const char *fname)
 {
        ofd = fopen(fname, "w");
        if (ofd == NULL) {
-               fatal(MYNAME ":Can not open %s for writing\n");
+               fatal(MYNAME ":Cannot open '%s' for writing\n", fname);
        }
 }
 
index aebf30d64b97c67e16744b4b098f533e9863344a..f6e508ed835a2bcf1c97fd3ad76b8c3f1bb26d05 100644 (file)
@@ -79,11 +79,11 @@ data_read(void)
        struct pdb_record *pdb_rec;
 
        if (NULL == (pdb = pdb_Read(fileno(file_in)))) {
-               fatal(MYNAME ": pdb_Read failed");
+               fatal(MYNAME ": pdb_Read failed\n");
        }
 
        if ((pdb->creator != MYCREATOR) || (pdb->type != MYTYPE)) {
-               fatal(MYNAME ": Not a gpspilot file.");
+               fatal(MYNAME ": Not a gpspilot file.\n");
        }
 
        for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) {
@@ -156,11 +156,11 @@ gpspilot_writewpt(waypoint *wpt)
         opdb_rec = new_Record (0, 2, ct++, vdata-(char *)rec, (const ubyte *)rec);            
 
        if (opdb_rec == NULL) {
-               fatal(MYNAME ": libpdb couldn't create record");
+               fatal(MYNAME ": libpdb couldn't create record\n");
        }
 
        if (pdb_AppendRecord(opdb, opdb_rec)) {
-               fatal(MYNAME ": libpdb couldn't append record");
+               fatal(MYNAME ": libpdb couldn't append record\n");
        }
 }
 
index 4959d00505e374ebb5563a80f87298344788078b..1e83489ba74bed3f3fb1183ec373ed905a86692c 100644 (file)
@@ -426,7 +426,7 @@ terminit(const char *portname)
                        FORMAT_MESSAGE_IGNORE_INSERTS,
                        NULL,GetLastError(),0,
                        (LPTSTR) &buf,0,NULL);
-               fatal(MYNAME ": '%s' cannot be opened. %s", portname, buf);
+               fatal(MYNAME ": '%s' cannot be opened. %s\n", portname, buf);
        }
        tio.DCBlength = sizeof(DCB);
        GetCommState (comport, &tio);
@@ -450,7 +450,7 @@ terminit(const char *portname)
 
        if (!SetCommState (comport, &tio)) {
                CloseHandle(comport);
-               fatal(MYNAME ": set port settings");
+               fatal(MYNAME ": set port settings\n");
        }
 
        GetCommTimeouts (comport, &timeout);
@@ -459,7 +459,7 @@ terminit(const char *portname)
        timeout.WriteTotalTimeoutConstant = 1000;
        if (!SetCommTimeouts (comport, &timeout)) {
                CloseHandle (comport);
-               fatal(MYNAME ": set timeouts");
+               fatal(MYNAME ": set timeouts\n");
        }
 }
 
@@ -495,7 +495,7 @@ termwrite(char *obuf, int size)
        }
        WriteFile (comport, obuf, size, &len, NULL);
        if (len != size) {
-               fatal(MYNAME ":.  Wrote %d of %d bytes.", len, size);
+               fatal(MYNAME ":.  Wrote %d of %d bytes.\n", len, size);
        }
 }
 
@@ -933,6 +933,8 @@ mag_waypt_pr(const waypoint *waypointp)
                case gt_virtual:
                        icon_token = mag_find_token_from_descr("Virtual cache");
                        break;
+               default:
+                       break;
 
        }
        owpt = global_opts.synthesize_shortnames ?
index e5f4f36828564a181977636ec9f12b89011d2b20..b747678621b4e78f4b9e41452848051b226ab886 100644 (file)
@@ -29,7 +29,7 @@ xmalloc(size_t size)
        void *obj = malloc(size);
 
        if (!obj) {
-               fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+               fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", size);
        }
 
        return obj;
@@ -41,7 +41,7 @@ xcalloc(size_t nmemb, size_t size)
        void *obj = calloc(nmemb, size);
 
        if (!obj) {
-               fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+               fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", size);
        }
 
        return obj;
@@ -53,7 +53,7 @@ xstrdup(const char *s)
        char *o = strdup(s);
 
        if (!o) {
-               fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+               fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", strlen(s));
        }
 
        return o;